import React, {lazy} from "react";
import {Navigate} from "react-router-dom";
import type { RouteObject} from "react-router-dom";
let Layout = lazy(() => import('../views/layout/index'))
let MeunLayout = lazy(()=>import('../views/layout/MeunLayout'))
let UsersLayout = lazy(()=>import('../views/layout/UsersLayout'))
let ImInfo = lazy(()=>import('../views/im/imInfo'))
let KonJian = lazy(()=>import('../views/konjian/index'))
let Zhuye = lazy(()=>import('../views/konjian/zhuye/index'))
let Rizhi = lazy(()=>import('../views/konjian/rizhi/index'))
let AddRz = lazy(()=>import('../views/konjian/rizhi/addRz'))
let XiangCe = lazy(()=>import('../views/konjian/xiangce/index'))
let XcInfo = lazy(()=>import('../views/konjian/xiangce/xcInfo'))
let Lyb = lazy(()=>import('../views/konjian/liuyanban/index'))
let Test = lazy(()=>import('../views/chuangkou/ckIndex'))
let TongZhi = lazy(()=>import('../views/tongzhi/index'))
let UserInfo = lazy(()=>import('../views/tongzhi/userInfo'))
let UserBox = lazy(()=>import('../views/tongzhi/userBox'))
let SouSuo = lazy(()=>import('../views/chuangkou/souSuo'))
let Login = lazy(()=>import('../views/login/index'))
let SheZhi = lazy(()=>import('../views/chuangkou/sheZhi'))




const routers:RouteObject[] = [
  {
    path:"/",
    element:<Layout/>,
    handle:{
      name:"首页",
      isLogin:true
    },
    children:[
      {
        path:'imPage',
        element:<MeunLayout/>,
        handle:{
          isLogin:true
        },
        children:[
          {
            path:"imInfo",
            element:<ImInfo/>,
            handle:{
              isLogin:true
            },
          }
        ]
      },
      {
        path:'userPage',
        element:<UsersLayout/>,
        children:[
          {
            path: "tz",
            element: <TongZhi/>,
            handle:{
              isLogin:true
            },
          },
          {
            path: "userInfo",
            element: <UserInfo/>,
            handle:{
              isLogin:true
            },
          },

        ]
      },
      {
        path:'konJian',
        element:<KonJian/>,
        children:[
          {
            path:"zhuye",
            element:<Zhuye/>,
            handle:{
              isLogin:true
            },
          },
          {
            path:"Rizhi",
            element:<Rizhi/>,
            handle:{
              isLogin:true
            },
          },


          {
            path:"AddRz",
            element:<AddRz/>,
            handle:{
              isLogin:true
            },
          },
          {
            path:"XiangCe",
            element:<XiangCe/>,
            handle:{
              isLogin:true
            },
          },
          {
            path:"XcInfo",
            element:<XcInfo/>,
            handle:{
              isLogin:true
            },
          },
          {
            path:"Lyb",
            element:<Lyb/>,
            handle:{
              isLogin:true
            },
          },
          {
            index:true,
            element:<Zhuye/>,
            handle:{
              isLogin:true
            },
          }
        ]
      },
      {
        index:true,
        element:<MeunLayout/>
      }
    ]
  },
  {
  path:"/test",
    element:<Test/>,
    handle:{
      isLogin:true
    },
  },
  {
    path: "/userBox",
    element: <UserBox/>,
    handle:{
      isLogin:true
    },
  },
  {
    path: "/sousuo",
    element: <SouSuo/>,
    handle:{
      isLogin:true
    },
  },
  {
    path: "/shezhi",
    element: <SheZhi/>,
    handle:{
      isLogin:true
    },
  },
  {
    path: "/login",
    element: <Login/>,
    handle:{
      isLogin:false
    },
  }

]

export default  routers
